package com.week2.zuhe;

public class MyPoint 
{
	private int x;
	private int y;
	public MyPoint() 
	{
		
	}
	public MyPoint(int x, int y) 
	{
		this.x = x;
		this.y = y;
	}
	public int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}
	public int[] getXY()
	{
		int[] a = {x,y};
		return a;
	}
	public void setXY(int x,int y)
	{
		this.x = x;
		this.y = y;
	}
	
	public String toString()
	{
		return "("+x+","+y+")";
	}
	
	public double distance(int x,int y)
	{
		return Math.sqrt(Math.pow((this.x-x),2)+Math.pow((this.y-y),2));
	}
	
	public double distance(MyPoint myPoint)
	{
		return Math.sqrt(Math.pow((this.x-myPoint.getX()),2)+Math.pow((this.y-myPoint.getY()),2));
	}
	public double distance()
	{
		return Math.sqrt(x*x+y*y);
	}

}
